Skip to content

infra: add setup-llvm composite action#1894

Merged
jpgaribotti merged 2 commits into
mainfrom
setup-llvm
May 5, 2026
Merged

infra: add setup-llvm composite action#1894
jpgaribotti merged 2 commits into
mainfrom
setup-llvm

Conversation

@jpgaribotti

Copy link
Copy Markdown
Contributor

🎯 What problem does this PR solve?

  • Every C++ workflow in the repo (prebuild, cpp-tests, coverage, benchmark, cpp-lint) inlines its own sudo ./llvm.sh 19 all — sometimes mid-script — and Windows runners drift on choco upgrade llvm -y (no version pin). Bumping the LLVM major or pinning a Windows fix means hand-editing ~15 workflows + 9 vcpkg toolchain files in lockstep.
  • We need a single source of truth for the LLVM/Clang major used across the monorepo so future bumps are a one-line change.
  • Concretely: a fix landed in LLVM 22 on Windows that we want to pin (chocolatey 22.1.0) without letting choco upgrade llvm silently drift again the next time chocolatey ships a patch.

📝 How does it solve it?

  • Adds .github/actions/setup-llvm — a composite action that becomes the single point to bump the LLVM major across the whole repo. Two inputs:
    • version (default 22) — major used for the apt.llvm.org install on Linux.
    • windows-version (default 22.1.0) — exact chocolatey pin on Windows; explicit so a chocolatey patch release can't change CI behaviour without a code change.
  • Linux: llvm.sh <version> all from apt.llvm.org, then prepends /usr/lib/llvm-<version>/bin to $GITHUB_PATH. The apt packages already drop unversioned clang, clang++, clang-format, clang-tidy, git-clang-format, lld, llvm-cov, llvm-profdata, etc. under that directory, so a single PATH prepend makes them resolve to the chosen major for the rest of the job — no update-alternatives needed, and /usr/bin/clang-<N> keeps working for anything that still hard-codes a version.
  • Windows: choco upgrade llvm --version=<windows-version> -y --allow-downgrade, then prepends C:\Program Files\LLVM\bin to $GITHUB_PATH. Uses shell: powershell (Windows PowerShell 5.1) since the self-hosted windows-11 runners don't ship pwsh.
  • macOS: no-op (Apple Clang is already configured via setup-apple-clang).

🧪 How was it tested?

  • Action invoked from a follow-up branch on Linux (ubuntu-22.04, ubuntu-24.04) and Windows (windows-11); confirmed clang --version resolves to LLVM 22.x on both, git-clang-format / clang-format / clang-tidy are on PATH unversioned, and bare-make generate picks them up via the unversioned linux-clang.cmake toolchain.
  • Verified the Windows step works under PowerShell 5.1 (no pwsh dependency).
  • This PR is intentionally just the action; the workflow / vcpkg toolchain / docs cutover that consumes it lands in a follow-up PR so this one stays small and reviewable.

New composite action that installs LLVM/Clang to a pinned version on
Linux and Windows runners and exposes the unversioned binaries on PATH.
Intended to become the single source of truth for the LLVM major used
across every prebuild / cpp-test / coverage / benchmark workflow in the
monorepo: bumping `version` (Linux apt major) and `windows-version`
(chocolatey full pin) defaults rolls the whole repo forward in one
place.

- Linux: install via apt.llvm.org `llvm.sh <version> all`, then prepend
  `/usr/lib/llvm-<version>/bin` to `$GITHUB_PATH` so unversioned
  `clang`, `clang++`, `clang-format`, `clang-tidy`, `git-clang-format`,
  `lld`, `llvm-cov`, `llvm-profdata`, ... resolve to the chosen major.
- Windows: `choco upgrade llvm --version=<windows-version> -y
  --allow-downgrade` (defaults to a specific patch release to avoid
  silent drift when chocolatey ships a new one) and add
  `C:\Program Files\LLVM\bin` to `$GITHUB_PATH`.
- macOS: no-op (Apple Clang is set up via setup-apple-clang).

Defaults: version=22, windows-version=22.1.0.
@jpgaribotti jpgaribotti requested a review from a team as a code owner May 5, 2026 07:22
@github-actions

github-actions Bot commented May 5, 2026

Copy link
Copy Markdown
Contributor

Tier-based Approval Status

**PR Tier:** TIER1

**Current Status:** ✅ APPROVED

**Requirements:**
- 1 Team Member approval ✅ (1/1)
- 1 Team Lead OR Management approval ✅ (1/1)



---
*This comment is automatically updated when reviews change.*

@jpgaribotti

Copy link
Copy Markdown
Contributor Author

/review

@jpgaribotti jpgaribotti merged commit 0c819dd into main May 5, 2026
8 checks passed
@jpgaribotti jpgaribotti deleted the setup-llvm branch May 5, 2026 09:08
gianni-cor added a commit that referenced this pull request May 5, 2026
setup-build-host is pinned by SHA at every caller, so changes to its
install path only take effect once each caller bumps its `@<sha>` pin.
Land this first so the follow-up PR — which switches every C++
workflow to call the dedicated `setup-llvm` composite action (#1894)
and bumps the setup-build-host pin in lockstep — can do both moves in
one squash-merge without double-installing LLVM (19 here + 22 in
setup-llvm) on every prebuild / cpp-lint job in the interim.

Callers pinned to the old SHA are unaffected. Callers that bump to
this SHA MUST invoke `setup-llvm` themselves on Linux and Windows
runners; this action no longer provides a Clang toolchain.

Co-authored-by: gianni-cor <gianfranco.cordella@tether.io>
tamer-hassan-tether pushed a commit that referenced this pull request May 5, 2026
New composite action that installs LLVM/Clang to a pinned version on
Linux and Windows runners and exposes the unversioned binaries on PATH.
Intended to become the single source of truth for the LLVM major used
across every prebuild / cpp-test / coverage / benchmark workflow in the
monorepo: bumping `version` (Linux apt major) and `windows-version`
(chocolatey full pin) defaults rolls the whole repo forward in one
place.

- Linux: install via apt.llvm.org `llvm.sh <version> all`, then prepend
  `/usr/lib/llvm-<version>/bin` to `$GITHUB_PATH` so unversioned
  `clang`, `clang++`, `clang-format`, `clang-tidy`, `git-clang-format`,
  `lld`, `llvm-cov`, `llvm-profdata`, ... resolve to the chosen major.
- Windows: `choco upgrade llvm --version=<windows-version> -y
  --allow-downgrade` (defaults to a specific patch release to avoid
  silent drift when chocolatey ships a new one) and add
  `C:\Program Files\LLVM\bin` to `$GITHUB_PATH`.
- macOS: no-op (Apple Clang is set up via setup-apple-clang).

Defaults: version=22, windows-version=22.1.0.
tamer-hassan-tether pushed a commit that referenced this pull request May 5, 2026
setup-build-host is pinned by SHA at every caller, so changes to its
install path only take effect once each caller bumps its `@<sha>` pin.
Land this first so the follow-up PR — which switches every C++
workflow to call the dedicated `setup-llvm` composite action (#1894)
and bumps the setup-build-host pin in lockstep — can do both moves in
one squash-merge without double-installing LLVM (19 here + 22 in
setup-llvm) on every prebuild / cpp-lint job in the interim.

Callers pinned to the old SHA are unaffected. Callers that bump to
this SHA MUST invoke `setup-llvm` themselves on Linux and Windows
runners; this action no longer provides a Clang toolchain.

Co-authored-by: gianni-cor <gianfranco.cordella@tether.io>
Proletter pushed a commit that referenced this pull request May 24, 2026
New composite action that installs LLVM/Clang to a pinned version on
Linux and Windows runners and exposes the unversioned binaries on PATH.
Intended to become the single source of truth for the LLVM major used
across every prebuild / cpp-test / coverage / benchmark workflow in the
monorepo: bumping `version` (Linux apt major) and `windows-version`
(chocolatey full pin) defaults rolls the whole repo forward in one
place.

- Linux: install via apt.llvm.org `llvm.sh <version> all`, then prepend
  `/usr/lib/llvm-<version>/bin` to `$GITHUB_PATH` so unversioned
  `clang`, `clang++`, `clang-format`, `clang-tidy`, `git-clang-format`,
  `lld`, `llvm-cov`, `llvm-profdata`, ... resolve to the chosen major.
- Windows: `choco upgrade llvm --version=<windows-version> -y
  --allow-downgrade` (defaults to a specific patch release to avoid
  silent drift when chocolatey ships a new one) and add
  `C:\Program Files\LLVM\bin` to `$GITHUB_PATH`.
- macOS: no-op (Apple Clang is set up via setup-apple-clang).

Defaults: version=22, windows-version=22.1.0.
Proletter pushed a commit that referenced this pull request May 24, 2026
setup-build-host is pinned by SHA at every caller, so changes to its
install path only take effect once each caller bumps its `@<sha>` pin.
Land this first so the follow-up PR — which switches every C++
workflow to call the dedicated `setup-llvm` composite action (#1894)
and bumps the setup-build-host pin in lockstep — can do both moves in
one squash-merge without double-installing LLVM (19 here + 22 in
setup-llvm) on every prebuild / cpp-lint job in the interim.

Callers pinned to the old SHA are unaffected. Callers that bump to
this SHA MUST invoke `setup-llvm` themselves on Linux and Windows
runners; this action no longer provides a Clang toolchain.

Co-authored-by: gianni-cor <gianfranco.cordella@tether.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants